#include "stm32f10x.h"                  // Device header

void MyDMA_Init(uint32_t AddrA,uint32_t AddrB,uint16_t Size)
{
	RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA1,ENABLE);
	
	DMA_InitTypeDef DMA_InitTypeDefStructure;
	DMA_InitTypeDefStructure.DMA_PeripheralBaseAddr = AddrA;
	DMA_InitTypeDefStructure.DMA_PeripheralDataSize = DMA_MemoryDataSize_Byte;
	DMA_InitTypeDefStructure.DMA_PeripheralInc = DMA_PeripheralInc_Enable;
	DMA_InitTypeDefStructure.DMA_MemoryBaseAddr = AddrB;
	DMA_InitTypeDefStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte;
	DMA_InitTypeDefStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;
	DMA_InitTypeDefStructure.DMA_BufferSize = Size;
	DMA_InitTypeDefStructure.DMA_DIR = DMA_DIR_PeripheralSRC;
	DMA_InitTypeDefStructure.DMA_M2M = DMA_M2M_Enable;
	DMA_InitTypeDefStructure.DMA_Mode = DMA_Mode_Normal;
	DMA_InitTypeDefStructure.DMA_Priority = DMA_Priority_Medium;
	DMA_Init(DMA1_Channel1,&DMA_InitTypeDefStructure);
	
	DMA_Cmd(DMA1_Channel1,ENABLE);
}
